varying vec3 vLightVector;
varying vec3 vNormal;
varying vec2 vTextCoord;

uniform sampler2D uTextureSampler;
uniform vec3 uColor;

void main() {
    vec3 AmbientColor = 0.3 * uColor;
    vec3 DiffuseColor = uColor * clamp(dot(normalize(vNormal), normalize(vLightVector)), 0.0, 1.0);
    vec4 LightTotal = vec4(AmbientColor + DiffuseColor, 1.0);

    if (vTextCoord.x >= -1.0) {
        vec3 textureColor = vec3(texture2D(uTextureSampler, vTextCoord));
        gl_FragColor = vec4(textureColor, 0.0);
    }
    else {
        vec3 AmbientColor = 0.3 * uColor;
        vec3 DiffuseColor = uColor * clamp(dot(normalize(vNormal), normalize(vLightVector)), 0.0, 1.0);
        vec4 LightTotal = vec4(AmbientColor + DiffuseColor, 1.0);
        gl_FragColor = LightTotal;
    }
}

